package top.roadvast.cors.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;

@RestController
public class CorsController {

    private static List<String> data = null;

    static {
        data = Arrays.asList("www.itsoku.com",
                "Spring高手系列",
                "SpringMVC系列",
                "MySQL系列",
                "高并发系列");
    }

    @RequestMapping(value = "/cors/test1")
    @CrossOrigin
    public List<String> test1() {
        return data;
    }

    @RequestMapping("/cors/test2")
    public List<String> test2(HttpServletResponse response) {
        return data;
    }

}
